package com.example.stuwork.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 作业提交记录实体类
 * 对应 submission 表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Submission implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 提交记录ID
     */
    private Long submissionId;

    /**
     * 作业ID
     */
    private Long assignmentId;

    /**
     * 学生学号
     */
    private String studentId;

    /**
     * 文件存储URL
     */
    private String fileUrl;

    /**
     * 提交时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date submitTime;

    /**
     * 状态：0-未批改，1-已批改
     */
    private Integer status;

    /**
     * 批改分数
     */
    private Integer score;

    /**
     * 教师评语
     */
    private String feedback;

    /**
     * 批改教师工号
     */
    private String teacherId;

    /**
     * 批改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gradedTime;

    /**
     * 提交版本号
     */
    private Integer version;

    /**
     * 是否迟交：0-否，1-是
     */
    private Integer isLate;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 非表字段：作业信息
     */
    private Assignment assignment;

    /**
     * 非表字段：学生信息
     */
    private Student student;

    /**
     * 非表字段：教师信息
     */
    private Teacher teacher;

    /**
     * 学生姓名（非持久化字段）
     */
    private String studentName;

    /**
     * 作业标题（非持久化字段）
     */
    private String assignmentTitle;

    /**
     * 教师姓名（非持久化字段）
     */
    private String teacherName;

    @Override
    public String toString() {
        return "Submission{" +
                "submissionId=" + submissionId +
                ", assignmentId=" + assignmentId +
                ", studentId='" + studentId + '\'' +
                ", fileUrl='" + fileUrl + '\'' +
                ", submitTime=" + submitTime +
                ", status=" + status +
                ", score=" + score +
                ", feedback='" + feedback + '\'' +
                ", teacherId='" + teacherId + '\'' +
                ", gradedTime=" + gradedTime +
                ", version=" + version +
                ", isLate=" + isLate +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
} 